﻿using System;

/// <summary>
/// 系统服务配置管理，只有管理员角色可以修改
/// </summary>

//系统功能类型
public enum FounctionType
{
	Login = 1 << 0,//登录功能
	Register = 1 << 1,//注册功能
	UploadArchive = 1 << 2,//上传档案功能
	DownloadArchive = 1 << 3,//下载档案功能
	LeaveWord = 1 << 4,//客户留言功能
}
//系统配置


public class SystemConfigure
{
	//从数据库中创建
	public SystemConfigure(
		Int32[] uploadArchivePoint,
		Int32[] downloadArchivePoint,
		FounctionType systemFunction)
	{
		_uploadArchivePoint = uploadArchivePoint;
		_downloadArchivePoint = downloadArchivePoint;
		_systemFunction = systemFunction;
	}
	//更新上传档案所需积分
	public void UpdateUploadPoint(Int32[] upPoint)
	{
		for (Int32 i = 0; i < 4; ++i)
			_uploadArchivePoint[i] = upPoint[i];
	}
	public void UpdateUploadPoint(ArchiveSecurityLevel secLevel, Int32 point)
	{
		_uploadArchivePoint[(Int32)secLevel] = point;
	}
	//更新下载档案所需积分
	public void UpdateDownloadPoint(Int32[] dnPoint)
	{
		for (Int32 i = 0; i < 4; ++i)
			_downloadArchivePoint[i] = dnPoint[i];
	}
	public void UpdateDownloadPoint(ArchiveSecurityLevel secLevel, Int32 point)
	{
		_downloadArchivePoint[(Int32)secLevel] = point;
	}
	//设置系统功能
	public void SetSytstemFunction(FounctionType func)
	{
		_systemFunction = func;
	}
	//上传不同等级档案所需积分
	public Int32[] UploadArchivePoint
	{
		get { return _uploadArchivePoint; }
	}
	//下载不同等级档案所需积分
	public Int32[] DownloadArchivePoint
	{
		get { return _downloadArchivePoint; }
	}
	//系统功能；
	public FounctionType SystemFunction
	{
		get { return _systemFunction; }
	}

	private Int32[] _uploadArchivePoint;//上传不同等级档案所需积分
	private Int32[] _downloadArchivePoint;//下载不同等级档案所需积分
	private FounctionType _systemFunction;//系统功能，对应数据库里functionStates；
}
